package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.entity.SOrder;
import com.example.vo.SOrderDailyCountVO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 新订单表 Mapper 接口
 * </p>
 *
 * @author zh
 * @since 2024-05-13 10:36:29
 */
@Mapper
public interface SOrderMapper extends BaseMapper<SOrder> {
    /**
     * 分页查询可根据id模糊查询
     * @param orderId
     * @return
     */
    List<SOrder> page(Long orderId, LocalDateTime startTime, LocalDateTime endTime, Integer state,Long userId);
    @MapKey("state")
    List<Map<Integer,Long>> countByState(Long userId);

    List<SOrderDailyCountVO> getDailyCount();

    void disStock(Long skuId, Integer count);
}
